<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<style>
.all_list select {
	width: 120px;
}
</style>
<div class="r_location">
	<i class="r_txtico"></i> 订单管理&gt; 订单管理 
</div>
<div class="m-t10">
	<form id="rForm" action="" method="POST">
		<ul class="all_list">
			<li>
				<span class="all_title">客户姓名：</span> 
				<span><input type="text" id="customerName" name="userName" class="ui_input" /></span>
				<span class="all_title">客户手机号码:</span> 
				<span><input type="text" id="mobile" name="mobile" class="ui_input" /></span>
				<span class="all_title">订单号:</span> 
				<span><input type="text" id="orderNumber" name="orderNumber" class="ui_input" /></span>
				<span class="all_title">产品名字:</span> 
				<span><input type="text" id="productName" name="productName" class="ui_input" /></span>
				<span class="all_title">订单状态:</span> 
				<span>
					<select id="state" name="state" class="ui_select" >
						<option value="">请选择</option>
						<option value="ok">支付成功</option>
						<option value="cancel">取消支付</option>
						<option value="fail">支付失败</option>
						<option value="notpaid">未支付</option>
					</select>
				</span>
			</li>
			<li>
				<span class="all_title">订单时间：</span> 
				<span>
					<input type="text" id="beginDate" name="minDate" class="ui_input datepicker Wdate" dateFormat="yyyy-MM-dd HH:mm:ss" group='{"group": {"startId":"beginDate", "endId":"endDate","showNext": true}}' option='start-auto-end' />至 
					<input type="text" id="endDate" name="maxDate" dateFormat="yyyy-MM-dd HH:mm:ss" class="ui_input datepicker Wdate" validator='{"label":"有效时间","required":true}' option='start-auto-end'/>
				</span>
			</li>
			<li>
				<span class="all_title"></span> 
				<span><input type="button"
					onclick="search()" value="查询" class="search_btn m-r15" /> <input
					type="reset" value="重置" class="reset_btn" /> <input type="button"
					onclick="exportRole()" value="导出" class="search_btn m-r15" /></span>
			</li>
		</ul>
	<div class="clearfix table_fn">
			<span class="l">订单管理数据列表</span> <span class="r"
				style="_margin-top: 5px;"> <!--  <a href="#" title="" class="add_ico" onclick="addAbout()" id="add_term">新增</a>-->
			</span>
	</div>
	
	<table id="about_table">
	</table>
	<div id="pgtoolbar"></div>
	</form>
</div>
<script>

   /*function addAbout(){
		to_page('/cms/productType/add/page');
   }

	function modify(id){
		to_page('/cms/productType/modify/page?id='+id);
	}*/
	
	/*function del(id){
		art.dialog({
			title : '删除',
			lock : true,
			content : '确认删除?',
			width : '200px',
		    cancelVal: '关闭',
		    cancel: true,
			ok : function () {
				$.post("cms/productType/delete", {id:id}, function(data) {
					//if(data.code!="01"){
						$("#about_table").jqGrid("setGridParam", {
							datatype : "json"
						}).trigger("reloadGrid", [ {
							page : 1
						} ]);
					//}
				});
			}
		});
	}*/
	$.datepicker();
	$(function() {
		$.jgrid.ajaxOptions.type = 'post';
		$("#about_table").jqGrid({
			url : "cms/orderNumber/view",
			datatype : "json",
			colModel : [{
				label : '订单号',
				name : 'orderNumber',
				index : 'orderNumber',
				width:150
			},{
				label : '手机号',
				name : 'mobile',
				index : 'mobile',
				width:100
			},{
				label : '产品名称',
				name : 'productName',
				index : 'productName',
				width:100
			},  {
				label : '用户名称',
				name : 'userName',
				index : 'userName',
				width:100
			},  {
				label : '价格',
				name : 'price',
				index : 'price',
				width:100
			},  {
				label : '创建时间',
				name : 'createDate',
				index : 'createDate',
				width:100
			},  {
				label : '折扣',
				name : 'discount',
				index : 'discount',
				width:100
			},  {
				label : '真实价格',
				name : 'realPrice',
				index : 'realPrice',
				width:100
			},  {
				label : '会员名称',
				name : 'memberName',
				index : 'memberName',
				width:100
			}, {
				label : '操作',
				name : 'operation',
				index : 'operation',
				width: 50,
				formatter:function(cell,options,row){
					return "暂无";
					/*var result = '';
					result = '<a href="#" onclick="modify(\''+row.id+'\')">修改</a>';
					result = result + ' <a href="#" onclick="del(\''+row.id+'\')">删除</a>';
					return result;*/
				}
			}],
			height : 370,
			rowNum : 10,
			rowList : [ 10, 20, 30 ],
			viewrecords : true,
			pager : '#pgtoolbar',
			autowidth : true,
			rownumbers : true,
			jsonReader : {
				root : "data",//当前记录
				page : "index",
				records : "totalRecord",//总记录数
				total : 'total',//总页数
				id : 'data.id',
				repeatitems : false
			}
			
		});
		function serialize_list(cell,options,row){
			var result = new Array();
			for(var i=0;i<cell.length;i++){
				result[i] = cell[i].name;
			}
			return result.join(';');
		};
	});
	function search() {
		var param = {
				userName : $('#customerName').val(),
				mobile : $('#mobile').val(),
				minDate : $('#beginDate').val(),
				maxDate : $('#endDate').val(),
				orderNumber : $('#orderNumber').val(),
				productName : $('#productName').val(),
				state:$("#state").val()
		};
		 
		var postData = $("#about_table").jqGrid("getGridParam", "postData");
		$.extend(postData, param);
		$("#about_table").jqGrid("setGridParam").trigger("reloadGrid", [ {
			page : 1
		} ]);
	}
	function exportRole() {
		$('#rForm').attr("action", "cms/orderNumber/getOrderNumber");
		$('#rForm').submit();
	}
</script>